package ooad.factory_method;

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Properties;

import ooad.factory.Car;

public abstract class CarFactory {
	
	public abstract Car createCar();
	
	public static CarFactory newFactory(){
		Properties pro=new Properties();
		try {
			pro.load(new FileInputStream("factory_config.txt"));
			Class c=Class.forName(pro.getProperty("FactoryType"));
			return (CarFactory)c.newInstance();
		}  catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		return null;
		
	}

}
